package com.mashibing.controller;

import com.mashibing.internalcommon.dto.Car;
import com.mashibing.internalcommon.dto.DriverUser;
import com.mashibing.internalcommon.dto.ResponseResult;
import com.mashibing.service.DriverUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.mashibing.internalcommon.remote.DriverUserClient;

@RestController
public class DriverUserController {
    @Autowired
    private DriverUserClient driverUserClient;

    @Autowired
    private DriverUserService driverUserService;

    @PostMapping("/updateUser")
    public ResponseResult updateUser(@RequestBody DriverUser driverUser) {
        return driverUserClient.updateUser(driverUser);
    }

    /**
     * 添加司机
     * @param driverUser
     * @return
     */
    @PostMapping("/addDriverUser")
    public ResponseResult addDriverUser(@RequestBody DriverUser driverUser){
        return driverUserService.addDriverUser(driverUser);
    }

    /**
     * 新增车辆
     * @param car
     * @return
     */
    @PostMapping("/addCar")
    public ResponseResult addCar(@RequestBody Car car){
        return driverUserService.addCar(car);
    }
}
